import { _decorator, Component, BoxCollider2D, RigidBody2D, Contact2DType, ERigidBody2DType, PhysicsSystem2D, Label } from 'cc';
import { pushBoxTs } from './pushBoxTs';
import { GlobalAttribute } from './SingletonPattern/GlobalAttribute';
const { ccclass } = _decorator;
@ccclass('touchBoxCollider')
export class touchBoxCollider extends Component {
    thenode;
    Global: GlobalAttribute;


    onLoad() {
        this.Global = GlobalAttribute.getInstance();

        // 获取 RigidBody2D 组件
        let rigidBody = this.getComponent(RigidBody2D);
        if (rigidBody) {
            // 启用碰撞监听器
            rigidBody.enabledContactListener = true;
        }
        
        PhysicsSystem2D.instance.fixedTimeStep = 1 / 120; // 增加物理引擎步长
        PhysicsSystem2D.instance.velocityIterations = 10; // 增加速度迭代次数
        PhysicsSystem2D.instance.positionIterations = 10; // 增加位置迭代次数
    }


}

